package cn.crm.dao;

import cn.crm.pojo.SysRole;
import cn.crm.pojo.SysUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

public interface SysUserDao extends BaseMapper<SysUser> {
    @Select("SELECT * FROM `sys_user` u JOIN `sys_role` r ON u.`usr_role_id`=r.`role_id`")
    @Results({
            @Result(property = "sysRole",column = "usr_role_id",javaType = SysRole.class,
            one = @One(select = "cn.crm.dao.SysRoleDao.selectById"))
    })
    Page<SysUser> getSysUserPageJoinSysRole(Page page);
}
